CustomVehicles = {}
CustomShipments = {}
function AddCustomShipment(name, model, entity, price, Amount_of_guns_in_one_shipment, Sold_seperately, price_seperately, noshipment, classes, shipmodel)
	if not name or not model or not entity or not price or not Amount_of_guns_in_one_shipment or (Sold_seperately and not price_seperately) then
		local text = "One of the custom shipments is wrongly made! Attempt to give name of the wrongly made shipment!(if it's nil then I failed):\n" .. tostring(name)
		print(text)
		hook.Add("PlayerSpawn", "ShipmentError", function(ply)
			if ply:IsAdmin() then ply:ChatPrint("WARNING: "..text) end end)		
		return
	end
	if not util.IsValidModel(model) then
		local text = "The model of shipment "..name.." is incorrect! can not create custom shipment!"
		print(text) 
		hook.Add("PlayerSpawn", "ShipmentError", function(ply)
			if ply:IsAdmin() then ply:ChatPrint("WARNING: "..text) end end)		
		return
	end
	local AllowedClasses = classes or {}
	if not classes then
		for k,v in pairs(team.GetAllTeams()) do
			table.insert(AllowedClasses, k)
		end
	end
	local price = tonumber(price)
	local shipmentmodel = shipmodel or "models/Items/item_item_crate.mdl"
	table.insert(CustomShipments, {name = name, model = model, entity = entity, price = price, weight = 5, amount = Amount_of_guns_in_one_shipment, seperate = Sold_seperately, pricesep = price_seperately, noship = noshipment, allowed = AllowedClasses, shipmodel = shipmentmodel})
end

function AddCustomVehicle(Name_of_vehicle, price, Jobs_that_can_buy_it)
	local function warn(add)
		local text
		if Name_of_vehicle then text = Name_of_vehicle end
		text = text.." FAILURE IN CUSTOM VEHICLE!"
		print(text)
		hook.Add("PlayerSpawn", "VehicleError", function(ply)
			if ply:IsAdmin() then ply:ChatPrint("WARNING: "..text.." "..add) end end)		
	end
	if not Name_of_vehicle or not price then
		warn("The name or the price is invalid/missing")
		return
	end
	local found = false
	for k,v in pairs(list.Get("Vehicles")) do
		if string.lower(k) == string.lower(Name_of_vehicle) then found = true break end
	end
	if not found then
		warn("vehicle not found!")
		return
	end
	table.insert(CustomVehicles, {name = Name_of_vehicle, price = price, allowed = Jobs_that_can_buy_it})
end

hook.Add("InitPostEntity", "AddShipments", function()
	if file.Exists("CustomShipments.txt") then
		timer.Simple(2, RunString, file.Read("CustomShipments.txt"))
		if SERVER then resource.AddFile("data/CustomShipments.txt") end
		if CLIENT and not LocalPlayer():IsSuperAdmin() then file.Delete("CustomShipments.txt") end
	end
end)

/*
How to add custom vehicles:
FIRST
go ingame, type rp_getvehicles for available vehicles!
then:
AddCustomVehicle(<One of the vehicles from the rp_getvehicles list>, <Price of the vehicle>, <OPTIONAL jobs that can buy the vehicle>)
Examples:
AddCustomVehicle("Jeep", 10000)
AddCustomVehicle("Airboat", 600, {TEAM_GUN})
AddCustomVehicle("Airboat", 600, {TEAM_GUN, TEAM_MEDIC})

Add those lines under your custom shipments. At the bottom of this file or in data/CustomShipments.txt

HOW TO ADD CUSTOM SHIPMENTS:
AddCustomShipment("<Name of the shipment(no spaces)>"," <the model that the shipment spawns(should be the world model...)>", "<the classname of the weapon>", <the price of one shipment>, <how many guns there are in one shipment>, <OPTIONAL: true/false sold seperately>, <OPTIONAL: price when sold seperately>, < true/false OPTIONAL: /buy only = true> , OPTIONAL which classes can buy the shipment, OPTIONAL: the model of the shipment)

Notes:
MODEL: you can go to Q and then props tab at the top left then search for w_ and you can find all world models of the weapons!
CLASSNAME OF THE WEAPON
there are half-life 2 weapons you can add:
weapon_pistol
weapon_smg1
weapon_ar2
weapon_rpg
weapon_crowbar
weapon_physgun
weapon_357
weapon_crossbow
weapon_slam
weapon_bugbait
weapon_frag
weapon_physcannon
weapon_shotgun
gmod_tool

But you can also add the classnames of Lua weapons by going into the weapons/ folder and look at the name of the folder of the weapon you want.
Like the player possessor swep in addons/Player Possessor/lua/weapons You see a folder called weapon_posessor 
This means the classname is weapon_posessor

YOU CAN ADD ITEMS/ENTITIES TOO! but to actually make the entity you have to press E on the thing that the shipment spawned, BUT THAT'S OK!
YOU CAN MAKE GUNDEALERS ABLE TO SELL MEDKITS!

true/false: Can the weapon be sold seperately?(with /buy name) if you want yes then say true else say no

the price of sold seperate is the price it is when you do /buy name. Of course you only have to fill this in when sold seperate is true.


EXAMPLES OF CUSTOM SHIPMENTS(remove the // to activate it): */

//AddCustomShipment("HL2pistol", "models/weapons/W_pistol.mdl", "weapon_pistol", 500, 10, false, 200, false, {TEAM_GUN, TEAM_MEDIC})

--EXAMPLE OF AN ENTITY(in this case a medkit)
--AddCustomShipment("bball", "models/Combine_Helicopter/helicopter_bomb01.mdl", "sent_ball", 100, 10, false, 10, false, {TEAM_GUN}, "models/props_c17/oildrum001_explosive.mdl")
--EXAMPLE OF A BOUNCY BALL:   		NOTE THAT YOU HAVE TO PRESS E REALLY QUICKLY ON THE BOMB OR YOU'LL EAT THE BALL LOL
--AddCustomShipment("bball", "models/Combine_Helicopter/helicopter_bomb01.mdl", "sent_ball", 100, 10, true, 10, true)
-- ADD CUSTOM SHIPMENTS HERE(next line):

AddCustomShipment("M249", "models/weapons/w_mach_m249para.mdl", "weapon_real_cs_m249", 6000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Galil", "models/weapons/w_rif_galil.mdl", "weapon_real_cs_galil", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("AK47", "models/weapons/w_rif_ak47.mdl", "weapon_real_cs_ak47", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("M4A1", "models/weapons/w_rif_m4a1.mdl", "weapon_real_cs_m4a1", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("FAMAS", "models/weapons/w_rif_famas.mdl", "weapon_real_cs_famas", 4500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("AWM", "models/weapons/w_snip_awp.mdl", "weapon_real_cs_awp", 6500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Scout", "models/weapons/w_snip_scout.mdl", "weapon_real_cs_scout", 5500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("AUG", "models/weapons/w_rif_aug.mdl", "weapon_real_cs_aug", 5000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("SG-552", "models/weapons/w_rif_sg552.mdl", "weapon_real_cs_sg552", 6000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("G3/SG1", "models/weapons/w_snip_g3sg1.mdl", "weapon_real_cs_g3sg1", 6000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("SG-550", "models/weapons/w_snip_sg550.mdl", "weapon_real_cs_sg550", 6000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("UMP45", "models/weapons/w_smg_ump45.mdl", "weapon_real_cs_ump_45", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("P90", "models/weapons/w_smg_p90.mdl", "weapon_real_cs_p90", 3500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("TMP", "models/weapons/w_smg_tmp.mdl", "weapon_real_cs_tmp", 4500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("MP5", "models/weapons/w_smg_mp5.mdl", "weapon_real_cs_mp5a5", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("MAC10", "models/weapons/w_smg_mac10.mdl", "weapon_real_cs_mac10", 3500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("M4 Super 90", "models/weapons/w_shot_xm1014.mdl", "weapon_real_cs_xm1014", 3500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("M3 Super 90", "models/weapons/w_shot_m3super90.mdl", "weapon_real_cs_pumpshotgun", 3000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("M26 Fragmentation Grenade", "models/weapons/w_eq_fraggrenade.mdl", "weapon_real_cs_grenade", 3000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Flashbang Grenade", "models/weapons/w_eq_flashbang_thrown.mdl", "weapon_real_cs_flash", 2500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("M18 Smoke Grenade", "models/weapons/w_eq_smokegrenade.mdl", "weapon_real_cs_smoke", 2500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Dual Beretta 92G Elites", "models/weapons/w_pist_elite_dropped.mdl", "weapon_real_cs_elites", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Desert Eagle .50 AE", "models/weapons/w_pist_deagle.mdl", "weapon_real_cs_desert_eagle", 3000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("USP Tactical", "models/weapons/w_pist_usp.mdl", "weapon_real_cs_usp", 2500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("P226", "models/weapons/w_pist_p228.mdl", "weapon_real_cs_p228", 2500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Glock 18", "models/weapons/w_pist_glock18.mdl", "weapon_real_cs_glock18", 2000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Five-Seven", "models/weapons/w_pist_fiveseven.mdl", "weapon_real_cs_five-seven", 2500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Combat Knife", "models/weapons/w_knife_t.mdl", "weapon_real_cs_knife", 2500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("USP Match", "models/weapons/w_pistol.mdl", "weapon_pistol", 2500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("MP7", "models/weapons/w_smg1.mdl", "weapon_smg1", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("AR2 Pulse Rifle", "models/weapons/w_ar2.mdl", "weapon_ar2", 4500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("RPG", "models/weapons/w_rocket_launcher.mdl", "weapon_rpg", 8000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Crowbar", "models/weapons/w_crowbar.mdl", "weapon_crowbar", 2500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Physgun", "models/weapons/w_physics.mdl", "weapon_physgun", 3000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("357 Magnum", "models/weapons/w_357.mdl", "weapon_357", 3000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Crossbow", "models/weapons/w_crossbow.mdl", "weapon_crossbow", 4500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Pheropod", "models/weapons/w_knife_t.mdl", "weapon_bugbait", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("SPAS-12", "models/weapons/w_knife_t.mdl", "weapon_shotgun", 3000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Toolgun", "models/weapons/w_knife_t.mdl", "gmod_tool", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("MK3 Fragmentation Grenade", "models/weapons/w_grenade.mdl", "weapon_frag", 3000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("SLAM", "models/weapons/w_slam.mdl", "weapon_slam", 5000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Stunstick", "models/weapons/w_stunbaton.mdl", "weapon_stunstick", 3000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Medic Kit", "models/weapons/w_c4.mdl", "med_kit", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Arrest Baton", "models/weapons/w_stunbaton.mdl", "arrest_stick", 4500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Unarrest Baton", "models/weapons/w_stunbaton.mdl", "unarrest_stick", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Door Ram", "models/weapons/w_rocket_launcher.mdl", "door_ram", 4000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Weapon Checker", "models/weapons/w_c4.mdl", "weapon_stunstick", 3500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Lockpick", "models/weapons/w_crowbar.mdl", "lockpick", 3500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Pistol Ammo", "models/weapons/w_stunbaton.mdl", "item_ammo_pistol", 500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Rifle Ammo", "models/weapons/w_stunbaton.mdl", "item_ammo_rifle", 7500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Shotgun Ammo", "models/weapons/w_stunbaton.mdl", "item_ammo_shotgun", 1000, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Keys", "models/weapons/w_stunbaton.mdl", "keys", 1500, 10, false, 0, false, {TEAM_SALES})
AddCustomShipment("Pocket", "models/weapons/w_stunbaton.mdl", "pocket", 2000, 10, false, 0, false, {TEAM_SALES})

AddCustomVehicle("Jeep", 10000, {TEAM_SALES})
AddCustomVehicle("Airboat", 12000, {TEAM_SALES})